<?php 
	$front = Zend_Controller_Front::getInstance();
	
	//get module name
	$module =  $front->getRequest()->getModuleName();
	
	//get controller name
	$controller = $front->getRequest()->getControllerName();
	
	//get action	
	$action = $front->getRequest()->getActionName(); 
?>
<form id="frmAdminForm" method="get">
	<div class="searchBox">	
		
			<!-- title -->
			<div class="searchBoxLeft">
				<label class="title">Tìm kiếm</label>
			</div>
			
			<!-- search field-->
			<div class="searchBoxRight"> 
				<div class="blockField">
					<label for="keyword">Từ khóa</label>				
					<input type="text" name="keyword" value="<?php echo $this->keyword?>" id="keyword">
				</div> 
				<div class="blockField">
					<label for="fromDate">Từ ngày</label>
					<input type="text" name="fromDate" value="<?php echo $this->fromDate?>" class="datepicker" id="fromDate">
				</div>
				<div class="blockField">
					<label for="toDate">Đến ngày</label>
					<input type="text" name="toDate" value="<?php echo $this->toDate?>" class="datepicker" id="toDate">
				</div>
				<div class="blockField">
					<button name="search" class='button'> Tìm kiếm </button>
					<input type='reset' value="Xóa"
						name="reset" class="reset button" />
				</div>
			</div>
			<div class="clearb"></div>
	</div>
	<div class="listElement">	
		<table>
			<thead>				
				<tr>
					<th>STT</th>
					<th><input type="checkbox" id="checkall" value='checkall'/><label for="checkall"></label></th>
					<th>
						<?php echo $this->partial('partial/sort.phtml','admin',array(
								'columnname'=>'manufacture_name',
								'columntitle'=>'Tên Hãng sản xuất')
							)?>
					</th>				
								
					<th>
						<?php echo $this->partial('partial/sort.phtml','admin',array(
								'columnname'=>'manufacture_creation_time',
								'columntitle'=>'Ngày đăng')
							)?>
					</th>	
					<th>
							<?php echo $this->partial('partial/sort.phtml','admin',array(
								'columnname'=>'manufacture_status',
								'columntitle'=>'Trạng thái')
							)?>
						</th>				
					<th>Thao tác</th>
				</tr>
			</thead>
			<tbody>
				<?php 
					//số thứ tự bằng trang hiện tạ - 1, nhân với số phần tử hiển thị trong trang.
					$stt = ($this->paginator->getCurrentPageNumber()-1)*$this->paginator->getItemCountPerPage();
					$stt+=1;
				?>
				<?php 
					foreach($this->paginator as $item):
						$status = "Có";		
				?>				
				<tr>
					<!-- Số thứ tự -->
					<td><?php echo $stt++?></td>
					
					<!-- chọn nhiều phần tử -->
					<td><input type="checkbox" value="<?php echo $item['manufacture_id']?>" name="id[]"/></td>
					
					<!-- Tên tiếng việt -->
					<td>
						<?php echo $item["manufacture_name"]?>
						<br />
						<?php echo "alias: ". $item['manufacture_alias']?>
					</td>
			
					
					<!-- Thời gian tạo -->
					<td>
						<?php 
							$date = date_create($item['manufacture_creation_time']);
							echo date_format($date, 'd/m/Y');
						?>
					</td>
					<td>
							
							<?php 
							
							$status = ((int)$item['manufacture_status']==1)? "publish" : "unpublish";
							echo $this->partial('partial/icon.phtml','admin',array(
									'title'=>'kích hoạt hoặc vô hiệu',
									'href'=>$this->baseUrl('/admin/'.$controller.'/changestatus/id/').$item['manufacture_id'],
									'a_class'=>'changestatus',
									'class'=>$status
									
							))?>
		
						</td>
					<!-- Thao tác -->
					<td class="center">
						<a href="<?php echo $this->baseUrl()."/{$module}/{$controller}/update/id/{$item["manufacture_id"]}"?>" title="cập nhật" class="edit option">
							<span class="small-edit-icon">&nbsp;</span>
						</a>						
						<a href="<?php echo $this->baseUrl()."/{$module}/{$controller}/delete/id/{$item["manufacture_id"]}"?>" title="xóa" class="delete option">
							<span class="small-delete-icon">&nbsp;</span>
						</a>
					</td>
				</tr>
				<?php endforeach;?>
			</tbody>
		</table>		
		<input type="hidden" name='order' value="" id="order" />
		<div class="controller">			
							
			<?php echo $this->paginationControl($this->paginator,'Sliding','partial/pagination.phtml'); ?>	
			
		</div>
	</div>
</form>
<div class="clearb">&nbsp;</div>